/***
 * @Author: 黄生
 * @Date: 2024-01-29
 * @Description: 日志记录
***/

#ifndef LOG_H
#define LOG_H

#include <QObject>
#include <QFile>
#include <QDir>
#include <QtMessageHandler>
#include <QDateTime>
#include <QRunnable>
#include <QTextStream>
#include <iostream>
#include <QMutex>
#include <QRegularExpression>
#include <QCoreApplication>
#include "common.h"


#define MAX_STORE_DAYS 30 //最长可存放时间：30天
#define MAX_FILE_SIZE 10*1024*1024 //日志文件的最大空间：10M

QString getLogPath();

class Log : public QObject
{
    Q_OBJECT
private:
    static void SaveLog(QtMsgType type, const QMessageLogContext& context, const QString& msg); //保存日志
    void DelTimeOutLog(); //删除超时的日志

public:
    explicit Log(QObject *parent = nullptr);

signals:

public slots:
    void RecordLog();
};

#endif // LOG_H

